From: Florian Müllner Date: Fri, 11 Jan 2019 16:42:22 +0000 (+0100) Subject: dateMenu: Show weather location in section header X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~897^2^2~38 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=3cf67b12362bb62694bb601c57decc186e746d1d;p=gnome-shell.git dateMenu: Show weather location in section header It is useful information, in particular when the location is set automatically via geoclue. https://gitlab.gnome.org/GNOME/gnome-shell/issues/262 --- diff --git a/data/theme/gnome-shell-sass/_common.scss b/data/theme/gnome-shell-sass/_common.scss index 801792fa3..d952f1427 100644 --- a/data/theme/gnome-shell-sass/_common.scss +++ b/data/theme/gnome-shell-sass/_common.scss @@ -922,6 +922,11 @@ StScrollBar { font-weight: bold; } + .weather-header.location { + font-weight: normal; + font-size: 0.9em; + } + .world-clocks-grid, .weather-grid { spacing-rows: 0.4em; diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js index c87df8de2..0a6f267e7 100644 --- a/js/ui/dateMenu.js +++ b/js/ui/dateMenu.js @@ -218,9 +218,16 @@ var WeatherSection = class WeatherSection { this.actor.child = box; - box.add_child(new St.Label({ style_class: 'weather-header', - x_align: Clutter.ActorAlign.START, - text: _("Weather") })); + let titleBox = new St.BoxLayout(); + titleBox.add_child(new St.Label({ style_class: 'weather-header', + x_align: Clutter.ActorAlign.START, + x_expand: true, + text: _("Weather") })); + box.add_child(titleBox); + + this._titleLocation = new St.Label({ style_class: 'weather-header location', + x_align: Clutter.ActorAlign.END }); + titleBox.add_child(this._titleLocation); let layout = new Clutter.GridLayout({ orientation: Clutter.Orientation.VERTICAL }); this._forecastGrid = new St.Widget({ style_class: 'weather-grid', @@ -302,12 +309,14 @@ var WeatherSection = class WeatherSection { return; } + let info = this._weatherClient.info; + this._titleLocation.text = info.get_location().get_name(); + if (this._weatherClient.loading) { this._setStatusLabel(_("Loading…")); return; } - let info = this._weatherClient.info; if (info.is_valid()) { this._addForecasts(); return; @@ -325,6 +334,8 @@ var WeatherSection = class WeatherSection { if (!this.actor.visible) return; + this._titleLocation.visible = this._weatherClient.hasLocation; + this._updateForecasts(); } };